<template>
  <div>
    <a-steps :current="currentTab" style="width: 470px; text-align: center;">
      <a-step :title="$t('m.system.login.entity.username')"/>
      <a-step :title="$t('m.system.login.entity.verify')"/>
      <a-step :title="$t('m.system.login.entity.password')"/>
      <a-step :title="$t('m.system.login.entity.complete')"/>
    </a-steps>
    <div class="content">
      <step1 v-if="currentTab === 0" @nextStep="nextStep"/>
      <step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" :userList="userList"/>
      <step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" :userList="userList"/>
      <step4 v-if="currentTab === 3" @prevStep="prevStep" @finish="finish" :userList="userList"/>
    </div>
  </div>
</template>

<script>

  import Step1 from './Step1'
  import Step2 from './Step2'
  import Step3 from './Step3'
  import Step4 from './Step4'

  export default {
    name: 'Alteration',
    components: {
      Step1,
      Step2,
      Step3,
      Step4
    },
    data () {
      return {
        currentTab: 0,
        userList: {},
        // form
        form: null,
      }
    },
    methods: {
      nextStep (data) {
        this.userList = data
        if (this.currentTab < 4) {
          this.currentTab += 1
        }
      },
      prevStep (data) {
        this.userList = data
        if (this.currentTab > 0) {
          this.currentTab -= 1
        }
      },
      finish () {
        this.currentTab = 0
      }
    }
  }
</script>

